public class TestCampaign {

    public String member { get; set; }

    public String coming { get; set; }

    public String attendingeven { get; set; }


public String campaignid;
public String campaignmemberid;
public Feedback__c feedback;

/// SELECT LIST /////
public List<SelectOption> getItems() {
         List<SelectOption> options = new List<SelectOption>();
              options.add(new selectOption('Yes','Yes'));
              options.add(new selectOption('No','No'));
              options.add(new selectOption('MayBE','MayBE'));            
            return options;
        } 
        
        public List<SelectOption> getpeople() {
         List<SelectOption> options = new List<SelectOption>();
              options.add(new selectOption('1','1'));
              options.add(new selectOption('2','2'));
              options.add(new selectOption('3','3'));            
            return options;
        }           
        
      public PageReference doSave() {   
       
        campaignid =  ApexPages.CurrentPage().getParameters().get('campaignid');
        system.debug('anshul'+campaignid );
        campaignmemberid =  ApexPages.CurrentPage().getParameters().get('campaignmemberid');
        system.debug('anshul'+campaignmemberid );
        
       
       
 feedback__c fb = new feedback__c();
     fb.Are_you_coming_alone__c =coming;
        fb.Attending_Even__c =attendingeven ;
        fb.Campaign__c=campaignid ;
        fb.Campaign_Member_DI__c=campaignmemberid ;
        fb.How_many_ppl_will_come_with_you__c=member ;
        insert fb;
       
       CampaignMember  cm = [SELECT ContactId,LeadId,status FROM CampaignMember WHERE Id =:campaignmemberid];
        
        update cm;
    Task task = new Task();
    if(cm.LeadID!=Null){
        task.WhoId = cm.LeadID;
        }
        else{
    task.WhoId = cm.ContactId;  
    }  
    task.Description = 'Call this lead.';
        task.Priority = 'High';
        task.ReminderDateTime = System.now().addDays(2);
        task.Status = 'Not Started';
        task.Subject = 'New Lead';   
        insert task ;    
        return null;
      }
   
   
}